package middleware

import (
	"context"
	"github.com/cloudwego/hertz/pkg/app"
	"strconv"
	"time"
)

func HeaderMiddleware() app.HandlerFunc {
	return func(c context.Context, ctx *app.RequestContext) {
		// 设置相应头
		ctx.Response.Header.Set("Access-Control-Allow-Origin", "*")
		ctx.Response.Header.Set("Current-Time", strconv.FormatInt(time.Now().Unix(), 10))

		ctx.Next(c)
	}
}
